package com.google.code.geocoder.model;

import java.io.Serializable;
import java.util.List;

public class DirectionsLeg implements Serializable {
    private static final long serialVersionUID = 1L;

    private List<DirectionsStep> steps;
    private DirectionsDuration duration;
    private DirectionsDistance distance;
    private LatLng startLocation;
    private LatLng endLocation;
    private String startAddress;
    private String endAddress;

    public List<DirectionsStep> getSteps() {
        return steps;
    }

    public void setSteps(List<DirectionsStep> steps) {
        this.steps = steps;
    }

    public DirectionsDuration getDuration() {
        return duration;
    }

    public void setDuration(DirectionsDuration duration) {
        this.duration = duration;
    }

    public DirectionsDistance getDistance() {
        return distance;
    }

    public void setDistance(DirectionsDistance distance) {
        this.distance = distance;
    }

    public LatLng getStartLocation() {
        return startLocation;
    }

    public void setStartLocation(LatLng startLocation) {
        this.startLocation = startLocation;
    }

    public LatLng getEndLocation() {
        return endLocation;
    }

    public void setEndLocation(LatLng endLocation) {
        this.endLocation = endLocation;
    }

    public String getStartAddress() {
        return startAddress;
    }

    public void setStartAddress(String startAddress) {
        this.startAddress = startAddress;
    }

    public String getEndAddress() {
        return endAddress;
    }

    public void setEndAddress(String endAddress) {
        this.endAddress = endAddress;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        DirectionsLeg that = (DirectionsLeg) o;

        if (distance != null ? !distance.equals(that.distance) : that.distance != null) return false;
        if (duration != null ? !duration.equals(that.duration) : that.duration != null) return false;
        if (endAddress != null ? !endAddress.equals(that.endAddress) : that.endAddress != null) return false;
        if (endLocation != null ? !endLocation.equals(that.endLocation) : that.endLocation != null) return false;
        if (startAddress != null ? !startAddress.equals(that.startAddress) : that.startAddress != null) return false;
        if (startLocation != null ? !startLocation.equals(that.startLocation) : that.startLocation != null)
            return false;
        if (steps != null ? !steps.equals(that.steps) : that.steps != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = steps != null ? steps.hashCode() : 0;
        result = 31 * result + (duration != null ? duration.hashCode() : 0);
        result = 31 * result + (distance != null ? distance.hashCode() : 0);
        result = 31 * result + (startLocation != null ? startLocation.hashCode() : 0);
        result = 31 * result + (endLocation != null ? endLocation.hashCode() : 0);
        result = 31 * result + (startAddress != null ? startAddress.hashCode() : 0);
        result = 31 * result + (endAddress != null ? endAddress.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "DirectionsLeg{" +
                "steps=" + steps +
                ", duration=" + duration +
                ", distance=" + distance +
                ", startLocation=" + startLocation +
                ", endLocation=" + endLocation +
                ", startAddress='" + startAddress + '\'' +
                ", endAddress='" + endAddress + '\'' +
                '}';
    }
}
